package com.yn.pet.controller.app;


import com.yn.common.core.domain.AjaxResult;
import com.yn.pet.controller.pc.biz.DeviceInfoBizService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

@RestController
@AllArgsConstructor
@RequestMapping("/front/home")
@Api(tags = "app端——首页信息管理")
@Slf4j
public class HomeController {
    private final DeviceInfoBizService deviceInfoBizService;

    /**
     * 更新宠物类型
     * @param deviceId  设备id
     * @param petType 宠物类型
     * @return
     */
    @GetMapping("updatePetType")
    @ApiOperation("首页更新宠物类型")
    public AjaxResult updatePetType(@RequestParam @NotNull Long deviceId,
                                    @RequestParam @NotNull Integer petType) {
        deviceInfoBizService.updatePetType(deviceId, petType);
        return AjaxResult.success("更新成功");
    }
}
